/*
 * @Author: 
 * @Date: 2025-02-24 10:47:23
 * @LastEditor: zhuxiaoyi
 * @LastEditTime: 2025-06-15 10:49:59
 * @Description: 
 */
import { Body, Controller, Get, Post, Query,Inject } from '@midwayjs/core';
import { FileService } from '../service/fileCut.service';
import { FileQueryDto, MoveFilesDto, VirtualPathDto } from '../dto/fileCutDto';

@Controller('/cutApi')
export class FileController {
  @Inject()
  fileService: FileService;

  // 获取目录树（懒加载）
  @Get('/directoryTree')
  async getDirectoryTree(@Query() query: FileQueryDto) {
    return await this.fileService.getDirectoryTree(query);
  }

  // 获取文件列表
  @Get('/files')
  async getFilesInDirectory(@Query() query: FileQueryDto) {
    return await this.fileService.getFilesInDirectory(query);
  }

  // 生成虚拟路径
  @Post('/virtualPath')
  async generateVirtualPath(@Body() query: VirtualPathDto) {
    return await this.fileService.generateVirtualPath(query);
  }

  // 文件移植
  @Post('/move')
  async moveFiles(@Body() moveFilesDto: MoveFilesDto) {
    return await this.fileService.moveFiles(moveFilesDto);
  }

   // 文件移植
   @Post('/move2')
   async moveFiles2(@Body() moveFilesDto: MoveFilesDto) {
     return await this.fileService.moveFiles2(moveFilesDto);
   }
}
